package connection;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DBConnection {
	static Connection con;
	static String url;

	public static Connection getConnection() {

		try {
			String url = "jdbc:mysql://localhost:3306/dailynews";

			String driver = "com.mysql.jdbc.Driver";
			String username = "root";
			String userPassword = "111111";

			Class.forName(driver);
			try {
				con = DriverManager.getConnection(url, username, userPassword);

				// assuming your SQL Server's username is "username"
				// and password is "password"

			} catch (SQLException ex) {
				ex.printStackTrace();
			}
		} catch (ClassNotFoundException e) {
			System.out.println(e);
		}

		return con;
	}

}
